package com.akupilih.app.adapter;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.akupilih.app.BiodataFragment;
import com.akupilih.app.KarirFragment;
import com.akupilih.app.OrganisasiFragment;
import com.akupilih.app.PendidikanFragment;
import com.akupilih.app.PenghargaanFragment;

public class IndividuAdapter extends FragmentPagerAdapter {

	final int PAGE_COUNT = 5;
	private final String[] TITLES = { "Biodata", "Pendidikan", "Karir", "Organisasi", "Penghargaan" };
	String id;

	public IndividuAdapter(FragmentManager fragmentManager, String id) {
		super(fragmentManager);
		// TODO Auto-generated constructor stub
		this.id = id;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return PAGE_COUNT;
	}

	@Override
	public CharSequence getPageTitle(int position) {
		// TODO Auto-generated method stub
		return TITLES[position];
	}

	@Override
	public Fragment getItem(int arg0) {
		Bundle data = new Bundle();
		data.putString("id", id);
		switch (arg0) {

		/** tab1 is selected */
		case 0:
			BiodataFragment fragment1 = new BiodataFragment();
			fragment1.setArguments(data);
			return fragment1;

			/** tab2 is selected */
		case 1:
			PendidikanFragment fragment2 = new PendidikanFragment();
			fragment2.setArguments(data);
			return fragment2;
		case 2:
			KarirFragment fragment3 = new KarirFragment();
			fragment3.setArguments(data);
			return fragment3;
		case 3:
			OrganisasiFragment fragment4 = new OrganisasiFragment();
			fragment4.setArguments(data);
			return fragment4;
		case 4:
			PenghargaanFragment fragment5 = new PenghargaanFragment();
			fragment5.setArguments(data);
			return fragment5;

		}
		return null;
	}

}
